When deploying lambda function with terraform-aws-modules/lambda/aws
Terraform module, and trying to add allowed_triggers
to its configuration, e.g.:
I got an error "We currently do not support adding policies for $LATEST"
.
The fix for this, is to add:
Ref: https://registry.terraform.io/modules/terraform-aws-modules/lambda/aws/latest#faq
Q4: What does this error mean -
"We currently do not support adding policies for $LATEST."
? Answer: When the Lambda function is created withpublish = true
the new version is automatically increased and a qualified identifier (version number) becomes available and will be used when setting Lambda permissions.When
publish = false
(default), only unqualified identifier ($LATEST
) is available which leads to the error.The solution is to either disable the creation of Lambda permissions for the current version by setting
create_current_version_allowed_triggers = false
, or to enable publish of Lambda function (publish = true
).